const config = require("./config/config")
const path = require("path")
const {genJson, genModel} = require("./mod/genJson");
const {createOrCleanDir} = require("./mod/common");

// 清理目录
const tableDir = path.join(config.serverModelDir, 'jsonTable')
const modelDir = path.join(config.serverModelDir, 'jsonModel')
createOrCleanDir(tableDir, true)
createOrCleanDir(modelDir, false)

// 生成服务端用 json
// 取第4行字段
const clientOrServerRow = 4
const outJsonDir = path.join(config.serverJsonDir, 'excel')
const result = genJson(clientOrServerRow, outJsonDir, config.excelDir)

genModel(result.excelAndSheets, tableDir, modelDir, '../excel')
